package splitWordsBySeparator;

import java.util.ArrayList;
import java.util.List;

public class Solution {
    public List<String> splitWordsBySeparator(List<String> words, char separator) {
        List<String> ans = new ArrayList<>();
        for (String s: words) {
            int i = s.charAt(0);
            for (int j = 0; j < s.length(); j++) {
                if(s.charAt(j) == separator) {
                    ans.add(s.substring(i,j));
                    i = j+1;
                }
            }
            ans.add(s.substring(i,s.length()));
        }
        return ans;
    }
}
